Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for multiple font-face rules #3

Merged
merged 6 commits into from
Mar 4, 2018
Merged

Add support for multiple font-face rules #3

merged 6 commits into from
Mar 4, 2018

Conversation

dastoori
Copy link
Contributor

@dastoori dastoori commented Mar 3, 2018

Multiple font faces syntax uses an array instead of object but rtl-css-js doesn't know that and it converts the array to an object.

Example:

import { create } from 'jss';
import preset from 'jss-preset-default';
import rtl from 'jss-rtl';

const jss = create({ plugins: [...preset().plugins, rtl()] });

const styles = {
  '@global': {
    '@font-face': [
      {
        fontFamily: 'Vazir',
        fontStyle: 'normal',
        fontWieght: 'normal',
        src: 'url(https://cdn.rawgit.com/rastikerdar/vazir-font/61a73a5c/dist/Vazir.woff2) format("woff2")',
      },
      {
        fontFamily: 'Vazir',
        fontStyle: 'normal',
        fontWieght: 300,
        src: 'url(https://cdn.rawgit.com/rastikerdar/vazir-font/61a73a5c/dist/Vazir-Light.woff2) format("woff2")',
      },
    ]
  }
}

console.log(
  jss.createStyleSheet(styles).toString()
);
/*
@font-face {
  0: [object Object];
  1: [object Object];
}

---
it should be this instead:

@font-face {
  font-family: Vazir;
  font-style: normal;
  font-weight: nomal;
  src: url(https://cdn.rawgit.com/rastikerdar/vazir-font/61a73a5c/dist/Vazir.woff2) format("woff2");
}
@font-face {
  font-family: Vazir;
  font-style: normal;
  font-weight: 300;
  src: url(https://cdn.rawgit.com/rastikerdar/vazir-font/61a73a5c/dist/Vazir-Light.woff2) format("woff2");
}
*/

Copy link
Owner

@alitaheri alitaheri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, Thanks 👍 👍

@alitaheri alitaheri merged commit ec49000 into alitaheri:master Mar 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants